﻿using System;
using System.Collections.Generic;
using System.Text;

namespace csharpcore7_ch3_VirtualMember
{
    public class Asset
    {
        public string Name;
        //Liability债务属性
        public virtual decimal Liability => 0;  //表达体属性
    }
    public class Stock : Asset
    {
        public long SharesOwned;
    }
    public class House : Asset
    {
        public decimal Mortgage;
        public override decimal Liability => Mortgage;
    }
    class Chapt3_2_3_VirtualMethod
    {
        static void _Main()
        {
            House mansion = new House { Name = "McMansion",Mortgage=250000 };
            Asset a = mansion;
            Console.WriteLine(mansion.Liability);
            Console.WriteLine(a.Liability);
        }
    }
}
